/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.common.i;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.util.DisplayMetrics;
import java.io.File;

public class b {
    public static BitmapFactory.Options a(BitmapFactory.Options paramOptions) {
        if (paramOptions == null)
            paramOptions = new BitmapFactory.Options();
        paramOptions.inPurgeable = true;
        paramOptions.inPreferredConfig = Bitmap.Config.RGB_565;
        paramOptions.inDither = false;
        paramOptions.inInputShareable = true;
        return paramOptions;
    }

    public static Bitmap a(String paramString, boolean paramBoolean) {
        if ((paramString == null) || (!(new File(paramString).exists())))
            return null;
        c.a("BitmapUtils", new Object[] { "decodeFile patt :", paramString });
        c.a("BitmapUtils", new Object[] { "decodeFile patt size :", Long.valueOf(new File(paramString).length()) });
        BitmapFactory.Options localOptions = new BitmapFactory.Options();
        if (paramBoolean)
            localOptions = a(localOptions);
        localOptions.inDensity = 240;
        localOptions.inTargetDensity = DisplayMetrics.DENSITY_DEVICE;
        try {
            return BitmapFactory.decodeFile(paramString, localOptions);
        } catch (OutOfMemoryError localOutOfMemoryError1) {
            try {
                System.gc();
                return BitmapFactory.decodeFile(paramString, localOptions);
            } catch (OutOfMemoryError localOutOfMemoryError2) {
                System.gc();
            }
        }
        return null;
    }
}